package com.itheima.dao.store;

import com.itheima.domain.store.QuestionItem;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * QuestionItemMapper
 * 2021/10/19 9：51
 * created by yangyawen
 */
public interface QuestionItemMapper {

    //查询所有
    @Select("select * from st_question_item")
    List<QuestionItem> findAll();

    //新增
    @Insert("insert into st_question_item (id,question_id,content,img_url,is_right) values (id=#{id},question_id=#{questionId},content=#{content},img_url=#{imgUrl},is_right=#{isRight})")
    void save(QuestionItem questionItem);

    //删除
    @Delete("delete from st_question_item where id=#{id}")
    void delete(@Param("id") String id);

    //修改
    @Update("update st_question_item set question_id=#{questionId},content=#{content},img_url=#{imgUrl},is_right=#{isRight} where id=#{id}")
    void update(QuestionItem questionItem);

    //通过id查询该数据
    @Select("select * from st_question_item where id=#{id}")
    QuestionItem findById(@Param("id") String id);

}
